<?php
class Core_Data_Csrftoken implements Core_Data_Mainable {
	
	/**
	 * Usage:
	 * $csrf_token = new Core_Data_Csrftoken;
	 * $token = $this->csrf_token->main(null)
	 * @param array $variables
	 * @return string $csrf_token
	 * @see Core_Data_Mainable::main()
	 */
	public function main(array $variables = null){
		$csrf_token = base64_encode(openssl_random_pseudo_bytes(1));
		$_SESSION['csrf_token'] = $csrf_token;
		return $csrf_token;
	}
	
}